<?php

/**
 * dossier form base class.
 *
 * @method dossier getObject() Returns the current form's model object
 *
 * @package    e-DSL
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasedossierForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                       => new sfWidgetFormInputHidden(),
      'categorie_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'), 'add_empty' => false)),
      'type_id'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('type'), 'add_empty' => false)),
      'regionClient_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('regionClient'), 'add_empty' => false)),
      'departementClient_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('departementClient'), 'add_empty' => false)),
      'dateDossier'              => new sfWidgetFormDate(),
      'demandeur_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('demandeur'), 'add_empty' => true)),
      'client_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('client'), 'add_empty' => false)),
      'codeClient'               => new sfWidgetFormInputText(),
      'nomClient'                => new sfWidgetFormInputText(),
      'telClient'                => new sfWidgetFormInputText(),
      'mailClient'               => new sfWidgetFormInputText(),
      'participants_notifier_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('participants_notifier'), 'add_empty' => true)),
      'dateRealSouhaitee'        => new sfWidgetFormDate(),
      'dateReference'            => new sfWidgetFormDate(),
      'delaiStandar'             => new sfWidgetFormInputText(),
      'ferme'                    => new sfWidgetFormInputCheckbox(),
      'fermeTechnique'           => new sfWidgetFormInputCheckbox(),
      'external_id'              => new sfWidgetFormInputText(),
      'dateDernierRelance'       => new sfWidgetFormDate(),
      'brouillon'                => new sfWidgetFormInputCheckbox(),
      'enAttente'                => new sfWidgetFormInputCheckbox(),
      'raisonAttente'            => new sfWidgetFormInputText(),
      'supprimer'                => new sfWidgetFormInputCheckbox(),
      'urgent'                   => new sfWidgetFormInputCheckbox(),
      'justifurgence'            => new sfWidgetFormTextarea(),
      'dateDebutTraitement'      => new sfWidgetFormDateTime(),
      'dateFinTraitement'        => new sfWidgetFormDateTime(),
      'dateFermeture'            => new sfWidgetFormDate(),
      'dateFermetureTechnique'   => new sfWidgetFormDate(),
      'duree'                    => new sfWidgetFormInputText(),
      'referenceDemande'         => new sfWidgetFormInputText(),
      'created_at'               => new sfWidgetFormDateTime(),
      'updated_at'               => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'categorie_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('categorie'))),
      'type_id'                  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('type'))),
      'regionClient_id'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('regionClient'))),
      'departementClient_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('departementClient'))),
      'dateDossier'              => new sfValidatorDate(array('required' => false)),
      'demandeur_id'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('demandeur'), 'required' => false)),
      'client_id'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('client'))),
      'codeClient'               => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'nomClient'                => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'telClient'                => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'mailClient'               => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'participants_notifier_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('participants_notifier'), 'required' => false)),
      'dateRealSouhaitee'        => new sfValidatorDate(array('required' => false)),
      'dateReference'            => new sfValidatorDate(array('required' => false)),
      'delaiStandar'             => new sfValidatorInteger(array('required' => false)),
      'ferme'                    => new sfValidatorBoolean(array('required' => false)),
      'fermeTechnique'           => new sfValidatorBoolean(array('required' => false)),
      'external_id'              => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'dateDernierRelance'       => new sfValidatorDate(array('required' => false)),
      'brouillon'                => new sfValidatorBoolean(array('required' => false)),
      'enAttente'                => new sfValidatorBoolean(array('required' => false)),
      'raisonAttente'            => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'supprimer'                => new sfValidatorBoolean(array('required' => false)),
      'urgent'                   => new sfValidatorBoolean(array('required' => false)),
      'justifurgence'            => new sfValidatorString(array('required' => false)),
      'dateDebutTraitement'      => new sfValidatorDateTime(array('required' => false)),
      'dateFinTraitement'        => new sfValidatorDateTime(array('required' => false)),
      'dateFermeture'            => new sfValidatorDate(array('required' => false)),
      'dateFermetureTechnique'   => new sfValidatorDate(array('required' => false)),
      'duree'                    => new sfValidatorInteger(array('required' => false)),
      'referenceDemande'         => new sfValidatorInteger(array('required' => false)),
      'created_at'               => new sfValidatorDateTime(),
      'updated_at'               => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('dossier[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'dossier';
  }

}
